# 04-ATM.py
money= 500 # 存款
# 查询余额
def get_moeny(name):
    print(f'{name}，你好，你的余额剩余：{money}')
# 存款
def add_money(name):
    a = int(input('请输入存款金额')) 
    global money
    money = money+a 
    print(f"{name}你好，你的余额剩余：{money}RMB")
# 取款
def up_money(name):
    a = int(input('请输入取款金额：'))
    global money
    if a<=money:
        money-=a
        print(f"取款金额为：{a}RMB")
        print(f'{name},你好，还剩余{money}RMB')
    else:
        print('没钱还取啥')
# 主菜单
def menu(name):
    print(f'{name},你好，欢迎来到江信银行ATM,请选项操作：')
    while True:
        print('查询余额','[输入1]')
        print('存款\t','[输入2]')
        print('取款\t','[输入3]')
        print('退出\t','[输入4]')
        index = input('请输入您的选择:')
        if index=="4":break;
        if index=="1":get_moeny(name)
        if index=="2":add_money(name)
        if index=="3":up_money(name)
menu(input('请输入您的姓名：'))